//
//  TableViewPleaseholdView.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/22.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "TableViewPleaseholdView.h"

@implementation TableViewPleaseholdView

-(instancetype)initWithFrame:(CGRect)frame thePicStr:(nonnull NSString *)p_Str theTosStr:(nonnull NSString *)t_Str theMiaoStr:(NSString *)m_str theButStr:(nonnull NSString *)b_Str theButWidth:(CGFloat)b_Width{
    if (self = [super initWithFrame:frame]) {
        GLGWImageView * picImageView = [[GLGWImageView alloc] initInSuperView:self];
        picImageView.imageName = p_Str;
        [picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.top.equalTo(self);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(150)));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(150)));
        }];
        //
        GLGWLabel * tosLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self];
        tosLabel.text = t_Str;
        [tosLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self);
            make.top.equalTo(picImageView.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(20)));
        }];
        
        if (m_str.length > 0) {
            GLGWLabel * miaoShuLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:self];
            miaoShuLabel.text = m_str;
            [miaoShuLabel mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerX.equalTo(self);
                make.top.equalTo(tosLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
                make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
            }];
            //
            if (b_Str.length>0) {
                GLGWButton * actionBut = [[GLGWButton alloc] initWithTitle:b_Str titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor whiteColor] theCornerRadius:kHeightProportion_In_iPhoneTriploid(20) backgroundColr:kColor_Rule_Yellow inSuperView:self];
                [actionBut mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.centerX.equalTo(self);
                    make.top.equalTo(miaoShuLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(30));
                    make.width.equalTo(@(b_Width));
                    make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(40)));
                }];
            }

        }else{
            if (b_Str.length>0) {
                GLGWButton * actionBut = [[GLGWButton alloc] initWithTitle:b_Str titleLableFont:SYSTEMFONT(14) titleLableColor:[UIColor whiteColor] theCornerRadius:kHeightProportion_In_iPhoneTriploid(20) backgroundColr:kColor_Rule_Yellow inSuperView:self];
                [actionBut mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.centerX.equalTo(self);
                    make.top.equalTo(tosLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(40));
                    make.width.equalTo(@(b_Width));
                    make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(40)));
                }];
            }
        }
        
    }
    return self;
}

@end
